﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Riel_Gestion.dao;

namespace Riel_Gestion
{
    public partial class FrmListadoCliente : Form
    {
        FrmMain parent = null;        

        public FrmListadoCliente(FrmMain parent)
        {
            this.parent = parent;
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FrmListadoCliente_Load(object sender, EventArgs e)
        {
            dataGridClientes.DataSource = ClienteDAO.getList();            
        }

        private void dataGridClientes_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

            if (e.ColumnIndex == 0)
            {          
                //Mapeo los datos del grid al DTOCliente
                //FrmFiltroCliente frmFiltroCliente = new FrmFiltroCliente(this.parent);
                //frmFiltroCliente.IdCliente = dataGridClientes.Rows[e.RowIndex].Cells[1].Value.ToString();
                //frmFiltroCliente.ShowDialog();                

                FrmFichaCliente frmFichaCliente = new FrmFichaCliente();
                frmFichaCliente.IdCliente = dataGridClientes.Rows[e.RowIndex].Cells[1].Value.ToString();
                frmFichaCliente.MdiParent = this.parent;
                frmFichaCliente.Show();
            }
            
        }
    }
}
